<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>湘钢废钢加料系统</title>

    <script src="${ctxPath}/jquery/js/jquery.min.js"></script>
    <link rel="stylesheet" href="${ctxPath}/layuiadmin/layui/css/layui.css" media="all">
    <!--    <link rel="stylesheet" href="${ctxPath}/layuiadmin/style/admin.css" media="all">-->
    <link rel="stylesheet" href="${ctxPath}/login/css/login.css">
<body>
<script>

    $(document).ready(function () {
        var whei = $(window).width()
        $("html").css({fontSize: whei / 24});
        $(window).resize(function () {
            var whei = $(window).width();
            $("html").css({fontSize: whei / 24})
        });
    });
</script>
<div class="main">

    <div class="header">
        <div class="header-center fl">
            <div class="header-title">
                湘钢废钢加料系统
            </div>
            <div class="header-img"></div>
        </div>
        <div class="header-bottom fl"></div>

    </div>

    <div class="content">
        <div class="content-left">
            <!--<img src="images/d.png" alt="">-->
        </div>
        <div class="content-right">
            <div class="right-infp layui-form">
                <div class="right-infp-name">
                    <div class="layui-form-item">
                        <input type="text" name="username" id="LAY-user-login-username" lay-verify="required"
                               placeholder="用户名" class="layui-input" value="">
                    </div>
                </div>
                <div class="right-infp-name">
                    <div class="layui-form-item">
                        <input style="display: inline-block" type="password" name="password"
                               id="LAY-user-login-password" lay-verify="required"
                               placeholder="密码" class="layui-input" value="">

                    </div>
                </div>


              <!--  <div class="layui-form-item">
                    <div class="right-infp-vercode">
                        <input style="display: inline-block; vertical-align: middle;" type="text" style="width: 50%"
                               id="vercode" lay-verify="required"
                               name="vercode"
                               placeholder="图形验证码" class="layui-input">
                        <img src="" class="layadmin-user-login-codeimg" style="margin-left: 63%"
                             id="randCodeImage">


                    </div>
                </div>-->

                <!--                <div class="right-infp-vercode">-->
                <!--                                    <img src="" class="layadmin-user-login-codeimg" id="randCodeImage">-->
                <!--                    <img style="display: inline" src="" class="layadmin-user-login-codeimg" id="randCodeImage">-->

                <!--                </div>-->

                <div class="right-infp-btn">
                    <div class="layui-form-item">
                        <button class="btn layui-btn layui-btn-fluid" id="login" lay-submit
                                lay-filter="LAY-user-login-submit">登录
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>

<script src="${ctxPath}/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '${ctxPath}/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'user'], function () {
        var $ = layui.$
            , setter = layui.setter
            , admin = layui.admin
            , form = layui.form
            , router = layui.router()
            , search = router.search;

        form.render();

        //提交
        form.on('submit(LAY-user-login-submit)', function (data) {

            //提交 Ajax 成功后，关闭当前弹层并重载表格
            $.ajax({
                type: "post",
                url: '${ctxPath}/login',
                data: data.field, //获取提交的字段
                success: function (res) {
                    if (res.success) {
                        //登入成功的提示与跳转
                        layer.msg('登录成功', {
                            offset: '15px'
                            , icon: 1
                            , time: 1000
                        }, function () {
                            location.href = '${ctxPath}/index'; //后台主页
                        });
                    } else {
                        layer.msg(res.msg, {icon: 5});
                       /* $("#vercode").val('');
                        reloadRandCodeImage();*/
                    }
                }
            });

        });

        //初始验证码
        // reloadRandCodeImage();


        /**
         * 点击图片，刷新验证码
         */
       /* $('#randCodeImage').click(function () {
            reloadRandCodeImage();
        });*/


        /**
         * 刷新验证码
         */
        /*function reloadRandCodeImage() {
            var date = new Date();
            var img = document.getElementById("randCodeImage");
            img.src = '${ctxPath}/vercode?a=' + date.getTime();
        }*/

        //回车事件
        $('body').keydown(function () {
            if (event.keyCode == '13') {
                $("#login").click();
            }
        });

    });
</script>
</body>

<style>
    .layui-layer-content {
        /*font-size: 20px;*/
        /*background: red;*/
        color: #1e1f22;
        /*font-weight: bold;*/
    }
</style>
</html>